MOD_TARGETS = $(addprefix ../target/mgr_mod_,${shell cat mod_list})
MOD_CLEAN   = $(addprefix clean_,${shell cat mod_list})

.PHONY: all force clean

export TARGET_LD ?= ${TC_PREFIX}ld
export TARGET_CC ?= ${TC_PREFIX}gcc
export CCFLAGS	 ?= -gstabs -I../inc -I../.. -O0 -nostdlib -nostdinc -fno-builtin
export RM		 ?= rm
export LN        ?= ln
export FIND      ?= find
export ECHO      ?= echo

all: ${MOD_TARGETS}

../target/mgr_mod_%: % %/Makefile force
	@${ECHO} BEGIN mgr mod $< with custom Makefile
	${V}${SETENV} MOD_NAME=$< ${MAKE} -C $<
	@${ECHO} END mgr mod $<

../target/mgr_mod_%: % force
	@${ECHO} BEGIN mgr mod $< with default Makefrag.mk
	${V}${SETENV} MOD_NAME=$< ${MAKE} -C $< -f ../Makefrag.mk
	@${ECHO} END mgr mod $<

force:
